
public class SavingAccount extends BankAccount {
    private int count ;
    private double interestRate;
    public SavingAccount(double balance, int count, double interestRate) {
        super(balance);
        this.count = count;
        this.interestRate =interestRate;
    }
    public void earnMonthlyInterest() {
        count = 3;
        interestRate = getBalance()*interestRate;
        System.out.println("Monthly Interest: " + interestRate);
    }

    public double getinterestRate() {
        return interestRate;
    }

    public void setRate(double interestRate) {
        this.interestRate = interestRate;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    @Override
    public void deposit(double amount) {
        if(count != 0){
            super.deposit(amount);
        }else{
            super.deposit(amount-1);
        }
        count--;
    }

    @Override
    public void withdraw(double amount) {
        if(count != 0){
            super.withdraw(amount);
        }else {
            super.withdraw(amount+1);
        }
        count--;
    }

}
